import pymysql

# 1.连接MySQL
conn=pymysql.connect(host="127.0.0.1",port=3306,user="root",password="yafeilu",charset="utf8",db="unicom")
cursor=conn.cursor(cursor=pymysql.cursors.DictCursor)

# 2.发送指令
# sql = "select * from admin where id >3"
sql = "select * from admin where username=%s or id=%s"
# cursor.execute(sql,["鲁亚飞",5])
# data_list=cursor.fetchall()
# for row in data_list:
#     for k,v in row.items():
#         print(k,v)
# print(data_list)

cursor.execute(sql,["鲁亚飞",5])
data=cursor.fetchone()
print(data)

# 3.关闭连接
cursor.close()
conn.close()
